﻿using Cirrious.MvvmCross.Application;
using Cirrious.MvvmCross.ExtensionMethods;
using Cirrious.MvvmCross.Interfaces.ViewModels;
using Cirrious.MvvmCross.Interfaces.Views;
using Cirrious.MvvmCross.WindowsPhone.Platform;
using Cirrious.MvvmCross.WindowsPhone.Views;
using Microsoft.Phone.Controls;
using TeaLightV5.Foundation.MvvmCross.Application;
using TeaLightV5.Foundation.Ux.WinPhone.MvvmCross.Views;

namespace TeaLightV5.Foundation.Ux.WinPhone.MvvmCross.Platform
{
    public abstract class TeaBaseWindowsPhoneSetup : MvxBaseWindowsPhoneSetup
    {
        protected TeaBaseWindowsPhoneSetup(PhoneApplicationFrame rootFrame)
            : base(rootFrame)
        {
        }

        protected override void InitializeDefaultTextSerializer()
        {
            TeaLightV5.Foundation.MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded();
        }

        protected override void InitializeViewModelFramework()
        {
            this.RegisterServiceType<IMvxViewModelLoader, TeaViewModelLoader>();
            this.RegisterServiceType<IMvxViewModelLocatorAnalyser, MvxViewModelLocatorAnalyser>();
        }

        protected override MvxPhoneViewsContainer CreateViewsContainer(PhoneApplicationFrame rootFrame)
        {
            return new TeaPhoneViewsContainer(rootFrame);
        }

    }
}
